package com.xc.ezplan.admin.config;

import cn.dev33.satoken.stp.StpInterface;
import com.xc.ezplan.admin.service.impl.AdminPurviewServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lixingchen
 * @date 2022/12/16
 * @description 后台获取用户角色/权限实现类
 */
@Component
@RequiredArgsConstructor
public class StpInterfaceImpl implements StpInterface {

	private final AdminPurviewServiceImpl adminPurviewService;

	@Override
	public List<String> getPermissionList(Object loginId, String loginType) {
		return adminPurviewService.getPermissionsByUser(Long.valueOf((String) loginId));
	}

	@Override
	public List<String> getRoleList(Object loginId, String loginType) {
		return adminPurviewService.getRolesByUser(Long.valueOf((String) loginId));
	}
}
